package com.chaosj.memory.dto;

import com.chaosj.webmagic.DefaultLocalFileService;
import lombok.Data;

import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

/**
 * @className: BlogDto
 * @description:
 * @author: caoyangjie
 * @date: 2022/1/4
 **/
@Data
public class BlogDto  extends HandlerDto{
    private boolean articles;
    private Integer maxDepth = 1;
    private List<String> scrapes;

    public BlogDto(String[] args) {
        super(args);
        DefaultLocalFileService.set("/software/源来如此/scrape-resources");
        this.scrapes = Arrays.asList(args[1]);
        if( args.length >= 3 ){
            String value = args[2];
            try{
                articles = Boolean.valueOf(value);
            } catch(Exception e) {
                scrapes.add(2,value);
            }
        }
        if( args.length >= 4 ){
            this.maxDepth = Integer.valueOf(args[3]);
        }
    }
}
